<template>
	<view class="centxtx">
		<view class="ceshai">
			<view class="topstart">
			</view>
			<view class="header">
				<view class="hui" @click="member">
					<uni-icons type="left" size="16" color="#ffffff"></uni-icons>
				</view>
				<view class="aa">
					提现
				</view>
			</view>
		</view>

		<view class="whole">
			<view class="bei">
				<image
					src="https://cdn4.codesign.qq.com/screen-slices/2024/10/24/AE9KQ24VXEeW10gGYZl24/afye9js6cglbjdjj/542b03fc-67ce-4008-b000-7735915a7c8f.png?imageMogr2/thumbnail/700x650/interlace/1"
					mode=""></image>
			</view>

			<view class="lista">
				<view class="amount">
					<view class="text">
						可提现金额（元）
					</view>
					<view class="num" v-if="userInfo.balance">{{userInfo.balance}}</view>
					<view class="num" v-else>0</view>
					<!-- 		<view class="num">
						{{money.takeableIncome}}
					</view> -->
				</view>
				<view class="list">
					<view class="withdrawal">
						<view class="text">
							<view class="name" @click="memberc">
								设置账号
							</view>
						</view>
					</view>
					<!-- <view class="modtBox">
						<view class="modtBox-a">
							<view class="modtBox-a-a">
								<view class="text">￥</view>
								<input type="text" class="input-box" placeholder="请输入提现金额" />
							</view>
						</view>
						<view class="modtBox-a">
							<view class="modtBox-a-a">
								<view class="texta">全部提现</view>
							</view>
						</view>
					</view> -->
					<view class="modtBox">
						<view class="modtBox-a">
							<view class="modtBox-a-a">
								<view class="texta">提现至</view>
							</view>
						</view>
						<view class="modtBox-a">
							<view class="modtBox-a-a" v-if="!userName">
								<view class="texta">提现信息人为空</view>
							</view>
							<view class="modtBox-a-a" v-else>
								<view class="texta">支付宝</view>
								<view class="texta">{{userName}}</view>
								<view class="texta">{{phone}}</view>
							</view>
						</view>
					</view>
					<button class="button" @click="kickbackMemberIncomeTakes">全部提现</button>
				</view>
			</view>
			<view class="record">
				<view class="title">
					提现记录
				</view>
				<view class="recordul">
					<view class="recordli" v-for="item,index in list" :key="index">
						<view class="right">
							<!-- <image v-if="item.status == 0" src="../../static/273.png" mode=""></image>
							<image v-if="item.status == 1" src="../../static/272.png" mode=""></image> -->
							<view class="middle">
								<view class="name">
									账号：{{item.alipayAccount}}
								</view>
								<view class="number">
									姓名：{{item.alipayName}}
								</view>
							</view>
						</view>
						<view class="lift">
							<view class="name">
								<text v-if="item.status == 11">待审核</text>


								<text v-if="item.status == 12">已转账</text>
								<text v-if="item.status == 13">已驳回</text>

								￥{{item.totalAmount}}
							</view>
							<view class="number">
								{{item.createTime}}

							</view>
							<text v-if="item.status == 13">原因：{{item.rejectionReason}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	<!-- <view class="centxtx" v-else>
		<view class="ceshai">
			<view class="topstart">
			</view>
			<view class="header">
				<view class="hui" @click="member">
					<uni-icons type="left" size="16" color="#161414"></uni-icons>
				</view>
				<view class="aaa" style="color: black;">
					我的收益
				</view>
			</view>
		</view>
		<view class="" style="margin-top: 400rpx;">
			暂无内容
		</view>
	</view> -->
</template>

<script>
	import {
		incomeTakeList, //提现列表
		takeableIncome, //提现金额
		kickbackMemberIncomeTake, //提现
		memberInfo, //提现信息
		balanceRecord
	} from "../../request/api.js"
	export default {
		data() {
			return {
				list: [],
				uid: '',
				money: {},
				pageNo: 1,
				userName: '',
				phone: '',
				hide: '',
				name: '',
				userInfo: null,
			}
		},
		onReachBottom() {
			console.log(111);
			if (this.total <= this.list.length) {
				uni.showToast({
					title: '已加载全部数据',
					icon: "none"
				});
			} else {
				this.pageNo++;
				this.incomeTakeLista()
			}
		},
		onLoad() {},
		onShow() {
			this.list = []
			this.pageNo = 1 //总页数
			this.userInfo = uni.getStorageSync('userInfo')
			this.balanceRecorda()
			this.memberInfo()
			// this.takeableIncomea()
			this.incomeTakeLista()





		},
		methods: {
			balanceRecorda() {
				balanceRecord({
					pageNo: this.pageNo,
					memberId: uni.getStorageSync('userInfo').id
				}).then(res => {
					console.log(res);
					if (res.success) {
						// this.list = this.list.concat(res.result.page.records)
						// this.total = res.result.total; //数据总条数
						this.name = res.result
					}
				})
			},
			disableStatuss() {
				disableStatus().then(res => {
					console.log(res, 'aa');
					this.hide = res.result
				})
			},
			incomeTakeLista() {
				incomeTakeList({
					pageNo: this.pageNo,
					memberId: uni.getStorageSync('userInfo').id
				}).then(res => {
					console.log(res);
					if (res.success) {
						this.list = this.list.concat(res.result.records)
						this.total = res.result.total; //数据总条数
					}
				})
			},
			memberc() {
				console.log('aa');
				uni.navigateTo({
					url: '/pages/other/withdrawalsettings'
				})
			},
			kickbackMemberIncomeTakes() {
				if (!this.userInfo.balance) {
					uni.showToast({
						title: '金额为空',
						icon: 'none'
					})
					return
				}
				if (!this.userName || !this.phone) {
					uni.showToast({
						title: '提现信息人为空',
						icon: 'none'
					})
					return
				}
				kickbackMemberIncomeTake({
					// totalAmount: '10',
					alipayAccount: uni.getStorageSync('userInfo').alipayAccount,
					alipayName: uni.getStorageSync('userInfo').alipayName,
					totalAmount: this.userInfo.balance,
					memberId: uni.getStorageSync('userInfo').id
				}).then(res => {
					console.log(res);
					// this.takeableIncomea()
					if (res.result == true) {
						uni.showToast({
							title: '提现成功',
							icon: 'none'
						})
						this.memberInfo()
					}

				})
			},
			memberInfo() {
				memberInfo({
					id: uni.getStorageSync('userInfo').id
				}).then(res => {
					this.userName = res.result.alipayName
					this.phone = res.result.alipayAccount
					uni.setStorageSync('userInfo', res.result);
					this.userInfo = uni.getStorageSync('userInfo')
				})
			},
			takeableIncomea() {
				let uid = uni.getStorageSync('userInfo').id
				takeableIncome(uid).then(res => {
					console.log(res);
					this.money = res.result
				})
			},
			member() {
				uni.navigateBack({

				})
			},
		},
	}
</script>

<style scoped lang="less">
	.centxtx {
		width: 100%;
		min-height: 100vh;
		background: #f7f7f7;
	}

	.topstart {
		height: var(--status-bar-height);
	}

	.ceshai {
		// min-height: 100vh;
		// padding: 11rpx;
		// background-color: #fafafa;
		// margin-top: 480rpx;
		// height: 375rpx;
		// background: linear-gradient(22deg, #FAFAFA 0%, #FBE6E2 100%);
		position: fixed;
		top: 0;
		z-index: 99;
		background-color: rgba(0, 0, 0, 0);


	}

	.header {
		margin-top: 30rpx;
		// text-align: center;
		color: #ffffff;
		font-size: 36rpx;
		display: flex;
		align-items: center;


		// margin-bottom: 0rpx;
		.hui {
			width: 36rpx;
			height: 36rpx;
			margin-right: 240rpx;
			margin-left: 30rpx;

			image {
				width: 36rpx;
				height: 36rpx;
			}

			.aa {
				color: #ffffff;
			}
		}
	}

	.bei {
		width: 100vw;

		height: 534rpx;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 9;

		image {
			width: 100vw;

			height: 534rpx;
		}
	}

	.quanbu {
		// min-height: 100vh;
		// padding: 11rpx;
		// background-color: #fafafa;
		// margin-top: 480rpx;
	}



	.whole {
		min-height: 100vh;
		position: relative;
		top: 0;
		left: 0;
		padding-top: 200rpx;

		// z-index: -99;
		.lista {
			// border-radius: 20rpx;
			// padding-bottom: 20rpx;
			padding-top: 1rpx;
			position: relative;
			z-index: 10;

			.amount {
				margin-left: 80rpx;


				.text {
					color: #ffffff;
					font-size: 28rpx;
					font-weight: 500;
				}

				.num {
					color: #ffffff;
					font-size: 64rpx;
					font-weight: 900;
				}
			}

			.list {
				margin: 32rpx;
				border-radius: 32rpx;
				padding: 20rpx 28rpx 52rpx;
				background: #ffffff;

				.withdrawal {
					text-align: right;
					margin-bottom: 20rpx;

					.text {
						text-align: right;

						.name {
							text-align: right;
							color: #333333;
							font-size: 28rpx;
							font-weight: 500;
						}


					}


				}

				.modtBox {
					// height: 148rpx;
					z-index: 999;
					border-radius: 20rpx;
					padding-bottom: 20rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					flex-wrap: wrap;
					position: relative;


					.modtBox-a {
						display: flex;
						flex-direction: column;
						align-items: center;
						justify-content: space-between;
						font-size: 12px;
						font-weight: 500;
						margin-top: 20rpx;
						margin-right: 50rpx;

						.modtBox-a-a {


							// .input-box {
							// 	height: 40px;
							// 	width: 200px;
							// }

							.text {
								color: #333333;
								font-size: 72rpx;
								font-weight: 500;
							}

							.texta {
								color: #333333;
								font-size: 28rpx;
								font-weight: 500;
							}
						}
					}

				}

				.button {
					width: 586rpx;
					height: 86rpx;
					border-radius: 62rpx;
					opacity: 1;
					background: linear-gradient(90deg, #ff9c33 0%, #ff9c33 100%);
					color: #ffffff;

					font-size: 32rpx;
					font-weight: 700;
					margin-top: 98rpx;
				}
			}
		}

		.record {
			margin: 30rpx;
			margin-top: 60rpx;

			.title {
				color: #333333;
				font-size: 32rpx;
				font-weight: 700;
			}

			.recordul {


				margin-top: 20rpx;

				.recordli {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 18rpx 46rpx 18rpx 14rpx;
					margin-top: 20rpx;
					background: #ffffff;


					.right {
						display: flex;
						align-items: center;
						justify-content: space-between;

						image {
							width: 90rpx;
							height: 92rpx;
							margin-right: 20rpx;
						}

						.middle {
							text-align: left;

							.name {
								color: #333333;

								font-size: 32rpx;
								font-weight: 700;
							}

							.number {
								color: #999999;
								font-size: 24rpx;

								font-weight: 400;
							}
						}
					}

					.lift {
						text-align: right;

						.name {
							color: #333333;
							text-align: right;
							font-size: 32rpx;
							font-weight: 700;
						}

						.number {
							color: #999999;
							font-size: 24rpx;
							text-align: right;
							font-weight: 400;
						}
					}


				}
			}
		}

	}
</style>